/**
 *@auther: tang
 *@Date: 2021-03-01
 *Project: p2p-finance-manage-system
 */
import * as dictionary from "./dictionary";
import { axios } from "@/main";
export const dict = dictionary;

export const ip = "/markApi/finance";
// 用户
export async function login(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`/markApi/check/login`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
export async function addUser(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/check/addUser`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
export async function updateUser(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/check/updateUser`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
export async function logout(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/check/logout`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
// 借贷管理
// 更新标信息
export async function updateBidInfo(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/addDebit/update`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
export async function queryBids(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/loan/page`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
export async function addBid(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/addDebit/add`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}

// 上架-标的额外信息

export async function signInsert(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/sign/insert`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}

export async function signQuery(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/sign/findPage`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}

export async function signUpdate(params) {
  return new Promise((resolve, reject) => {
    axios
      .post(`${ip}/sign/update`, params)
      .then(res => {
        resolve(res);
      })
      .catch(err => {
        reject(err);
      });
  });
}
